package com.liuzh.deviceinfo.card;

import android.content.Context;
import android.content.res.Resources;
import android.util.AttributeSet;
import android.util.DisplayMetrics;
import android.widget.FrameLayout;
import android.widget.TextView;
import androidx.cardview.widget.CardView;
import c.h.a.m0.h;
import java.util.Locale;

public class DisplayDensityCard extends CardView {
    public DisplayDensityCard(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        setUseCompatPadding(true);
        FrameLayout.inflate(getContext(), 2131492927, this);
        DisplayMetrics displayMetrics = Resources.getSystem().getDisplayMetrics();
        ((TextView) findViewById(2131296408)).setText(h.i());
        TextView textView = (TextView) findViewById(2131296522);
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(displayMetrics.densityDpi);
        String str = " dpi";
        stringBuilder.append(str);
        textView.setText(stringBuilder.toString());
        textView = (TextView) findViewById(2131297347);
        stringBuilder = new StringBuilder();
        stringBuilder.append((int) displayMetrics.xdpi);
        stringBuilder.append(str);
        textView.setText(stringBuilder.toString());
        textView = (TextView) findViewById(2131297348);
        stringBuilder = new StringBuilder();
        stringBuilder.append((int) displayMetrics.ydpi);
        stringBuilder.append(str);
        textView.setText(stringBuilder.toString());
        textView = (TextView) findViewById(2131296707);
        Locale locale = Locale.US;
        String str2 = "%.2f";
        textView.setText(String.format(locale, str2, new Object[]{Float.valueOf(displayMetrics.density)}));
        ((TextView) findViewById(2131296854)).setText(String.format(locale, str2, new Object[]{Float.valueOf(displayMetrics.scaledDensity)}));
        ((TextView) findViewById(2131296571)).setText(String.format(locale, str2, new Object[]{Float.valueOf(getResources().getConfiguration().fontScale)}));
    }
}
